<%@page import="com.yoyo.schedule.ScheduleContext" %>
<%@page import="com.yoyo.schedule.zookeeper.ZooKeeperManager" %>
<%@page import="java.util.Properties" %>
<%@ page contentType="text/html; charset=GB2312" %>
<%

    Properties p = new Properties();
    p.setProperty(ZooKeeperManager.keys.zooKeeperConnectString.toString(), request.getParameter(ZooKeeperManager.keys.zooKeeperConnectString.toString()));
    p.setProperty(ZooKeeperManager.keys.rootPath.toString(), request.getParameter(ZooKeeperManager.keys.rootPath.toString()));
    p.setProperty(ZooKeeperManager.keys.userName.toString(), request.getParameter(ZooKeeperManager.keys.userName.toString()));
    p.setProperty(ZooKeeperManager.keys.password.toString(), request.getParameter(ZooKeeperManager.keys.password.toString()));
    p.setProperty(ZooKeeperManager.keys.zooKeeperSessionTimeout.toString(), request.getParameter(ZooKeeperManager.keys.zooKeeperSessionTimeout.toString()));
    try {
        ScheduleContext.saveConfigInfo(p);
    } catch (Exception e) {
        e.printStackTrace();
        response.sendRedirect("config.jsp?error=" + e.getMessage());
    }
%>
<script>
    if (parent != null) {
        parent.location.href = "index.jsp?manager=true";
    } else {
        window.location.href = "index.jsp?manager=true";
    }
</script>
